#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

class student
{
public:
    student(const string& name = "", int math = 0, int english = 0)
        :_name(name)
        , _math(math)
        , _english(english)
        , _sum(0)
    {}
    void calcTotal() { _sum = _math + _english; }
    const string getName() const { return _name; }
    int getMath() const { return _math; }
    int getEnglish() const { return _english; }
    int getTotal() const{ return _sum; }
private:
    string _name;
    int _math;
    int _english;
    int _sum;
};

void sortStudent(student* s, int num)
{
    for (int i = 0; i < num - 1; i++)
        for (int j = 0; j < num - i - 1; j++)
            if (s[j].getTotal() < s[j + 1].getTotal()) 
                swap(s[j], s[j + 1]);
}

int main()
{
    student s[3], temp;
    string sName;
    int sMath, sEnglish;
    int i;
    for (i = 0; i < 3; i++)
    {
        cin >> sName >> sMath >> sEnglish;
        s[i] = student(sName, sMath, sEnglish);
        s[i].calcTotal();
    }
    sortStudent(s, 3);
    for (i = 0; i < 3; i++)
    {
        cout << s[i].getName() << " " << s[i].getMath() << " " << s[i].getEnglish() << " " << s[i].getTotal() << endl;
    }
    return 0;
}

